﻿//
// Vector.cs
//
// Authors:
//    Claus Jørgensen <10229@iha.dk>
//    Jens Bloch Christensen <09584@iha.dk>
//    Jonas Daugaard Møller <08814@iha.dk>
//
using System.Diagnostics.Contracts;

namespace RSD.Robot
{
    /// <summary>
    /// Represents a in-memory vector used by the USBC-Controller.
    /// </summary>
    public class Vector
    {
        private readonly string name;
        private readonly Axis axis;
        private readonly short dimension;

        /// <summary>
        /// Initializes a new instance of the <see cref="T:Vector"/> class.
        /// </summary>
        internal Vector()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="T:Vector"/> class.
        /// </summary>
        /// <param name="axis">The axis of the vector.</param>
        /// <param name="name">The name of the vector.</param>
        /// <param name="dimension">The amount of coordinate points in the vector.</param>
        internal Vector(Axis axis, string name, short dimension)
        {
            Contract.Requires(!string.IsNullOrEmpty(name));

            this.axis = axis;
            this.name = name;
            this.dimension = dimension;
        }

        /// <summary>
        /// Gets the vectors corresponding axis.
        /// </summary>
        public Axis Axis
        {
            get
            {
                return axis;
            }
        }

        /// <summary>
        /// Gets the vector name. 
        /// </summary>
        public string Name
        {
            get
            {
                return name;
            }
        }

        /// <summary>
        /// Gets the amount of coordinate points in the vector.
        /// </summary>
        public short Dimension
        {
            get
            {
                return dimension;
            }
        }

        /// <summary>
        /// Gets or sets the vector position.
        /// </summary>
        public Position Position
        {
            get;
            internal set;
        }
    }
}
